﻿@using MediaGarden.ViewModels;
@{
    var typeDisplayName = Model.TypeDisplayName;
    var pageTitle = T("Media Garden: Sources");
    if (!string.IsNullOrWhiteSpace(typeDisplayName)) {
        pageTitle = T("Manage {0} Content", typeDisplayName);
    }

    Layout.Title = pageTitle;
    Style.Include("mediagarden-sources-admin.css");
}
<div class="manage">
@*    @Html.ActionLink(createLinkText.Text, "Create", new { Area = "Contents", Id = (string)Model.Options.SelectedFilter }, new { @class = "button primaryAction" }) *@
</div>
@using (Html.BeginFormAntiForgeryPost("",FormMethod.Post,new { enctype = "multipart/form-data" })){
    if (Model.Inputs != null)
    {
    <div class="media-inputs">
        @Display(Model.Inputs)
    </div>
    }
    <div class="source-settings">
        @InputExtensions.Hidden(Html,"mediaSessionId",Model.MediaSessionId)
    </div>
    if (Model.Sources != null)
    {
        <h2>Sources Available</h2>
        if (Model.Actions != null)
        {
        <fieldset class="source-actions">
            @Display(Model.Actions)
        </fieldset>
        }
        if (Model.Filters != null)
        {
        <fieldset class="source-filters">
            @Display(Model.Filters)
            <label for="filterResults" class="bulk-filter">@T("Show")</label>
            <select id="filterResults" name="Options.SelectedFilter">
                @Html.SelectOption((string)Model.Options.SelectedFilter, "", T("any (show all)").ToString())
                @foreach (var filterOption in Model.Options.FilterOptions)
                {
                    @Html.SelectOption((string)Model.Options.SelectedFilter, (string)filterOption.Key, (string)filterOption.Value)
                }
            </select>
            <label for="orderResults" class="bulk-order">@T("Ordered by")</label>
            <select id="orderResults" name="Options.OrderBy">
                @Html.SelectOption((ContentsOrder)Model.Options.OrderBy, ContentsOrder.Created, T("recently created").ToString())
                @Html.SelectOption((ContentsOrder)Model.Options.OrderBy, ContentsOrder.Modified, T("recently modified").ToString())
                @Html.SelectOption((ContentsOrder)Model.Options.OrderBy, ContentsOrder.Published, T("recently published").ToString())
            </select>
            <button type="submit" name="submit.Filter" value="yes please">@T("Apply")</button>
        </fieldset>
        }
        <fieldset class="contentItems bulk-items">
            @Display(Model.Sources)
        </fieldset>
        @Display(Model.Pager)
    }
}